/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TimeRecording.TimeClockServer.messages.rx;

import java.text.ParseException;
import java.util.Date;

/**
 *
 * @author david
 */
public class TimeMessage extends RxClockMessage {

    private final static SplitMessage MESSAGE_KEY = new SplitMessage(
            "[HDR]TR00[US]MSG-TIME[RS]CLOCK-TIME[RS][EOT]");

    private final static String MSG_TIME = "MSG-TIME";
    private final static String CLOCK_TIME = "CLOCK-TIME";

    public TimeMessage(byte[] msg) {
        super(msg, MESSAGE_KEY);
    }

    public Date getMessageTime() throws ParseException {
        return DATE_FORMATTER.parse(getPart(MSG_TIME));
    }

    public Date getClockTime() throws ParseException {
        return DATE_FORMATTER.parse(getPart(CLOCK_TIME));
    }
}
